#include<bits/stdc++.h>
using namespace std;

using ll = long long;
const int N = 1e5 + 9;
ll n, m, dep[N], fa[N][24], cnt[N], l[N], ans = -1;
struct node
{
    int point, s;
};
vector<node>g[N];

void dfs(int x, int p)
{
    dep[x] = dep[p] + 1;
    fa[x][0] = p;
    for (int i = 1; i <= 20; i++)
        fa[x][i] = fa[fa[x][i - 1]][i - 1];
    for (const auto& y : g[x])
    {
        if (y.point == p)continue;
        l[y.point] = y.s;
        dfs(y.point, x);
    }
}

int lca(int x, int y)
{
    if (dep[x] < dep[y])swap(x, y);
    for (int i = 20; i >= 0; i--)
        if (dep[fa[x][i]] >= dep[y])x = fa[x][i];
    if (x == y)return x;
    for (int i = 20; i >= 0; i--)
        if (fa[x][i] != fa[y][i])x = fa[x][i], y = fa[y][i];
    return fa[x][0];
}

void dfs1(int x)
{
    for (const auto& i : g[x])
    {
        if (i.point == fa[x][0])continue;
        dfs1(i.point);
        cnt[l[x]] += cnt[l[i.point]];
    }
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i < n; i++)
    {
        int u, v; cin >> u >> v;
        g[u].push_back({ v,i }), g[v].push_back({ u,i });
    }
    dfs(1, 0);
    for (int i = 1; i <= m; i++)
    {
        int u, v; cin >> u >> v;
        int p = lca(u, v);
        cnt[l[u]]++, cnt[l[v]]++, cnt[l[p]] -= 2;
    }
    dfs1(1);
    //for(int i=1;i<=n;i++)cout<<cnt[i]<<' ';cout<<'\n';
    for (int i = 1; i <= n; i++)
        if (cnt[i] == m)ans = i;
    cout << ans << '\n';
    return 0;
}